/*
 * Copyright (c) 2018 3 29
 * Yang Fei
 * KaolaFm Corp.
 */

package com.yangfei.mystudy1020.utils;

import android.content.Context;
import android.util.Log;

import com.yangfei.mystudy1020.BuildConfig;

/**
 * created by yangfei on 2018/3/29 12:13
 * KaolaFM
 */
public class PerformanceCheck {
    static long timeNow = System.currentTimeMillis();
    static long timeTotal = 0L;
    //adb shell am force-stop com.edog.car
    //adb shell am start -W -n com.edog.car/com.kaolafm.auto.home.MainActivity
    public static void performanceLog(Exception e){
        if(!BuildConfig.DEBUG)
            return;
        StackTraceElement[] trace = e.getStackTrace();
        if (trace == null)
            return;

        String className  = trace[0].getClassName();
        String FuncName = trace[0].getMethodName();
        int lineNum = trace[0].getLineNumber();
        long timeDif = System.currentTimeMillis()-timeNow;
        timeTotal += timeDif;
        Log.d("performanceLog", className + " " + FuncName +" "+lineNum+"  time=" + timeDif+" timetotal="+timeTotal);
        timeNow = System.currentTimeMillis();
    }
}
